#ifndef _BSP_TIME_INIT_H_
#define _BSP_TIME_INIT_H_

#include "stm32f4xx.h"    

#define LIMIT( x,min,max ) ( (x) < (min)  ? (min) : ( (x) > (max) ? (max) : (x) ) )

//#define PWM1  TIM2->CCR2
//#define PWM2  TIM3->CCR4
//#define PWM3_1 TIM4->CCR3
//#define PWM3_2 TIM4->CCR4
#define PWM1  TIM1->CCR1
#define PWM2  TIM2->CCR2
#define PWM3_1 TIM4->CCR3
#define PWM3_2 TIM4->CCR4

#define InitFrictionWheel()     \
        PWM1 = 500;             \
        PWM2 = 500;
#define SetFrictionWheelSpeed_big(x) \
        PWM1 = x;                
#define SetFrictionWheelSpeed_small(x) 	\
        PWM2 = x;
#define SetServeWheelAngle(x) \
        PWM3_1=x;             \
				PWM3_2=x;
		
typedef struct
{
  u32 Last_Time;
  u32 Now_Time;
  u32 Time_Delta;
}TIME_Handle;


u8 PWM_Out_Init_TIM1(uint16_t hz);
u8 PWM_Out_Init_TIM2(uint16_t hz);
u8 PWM_Out_Init_TIM3(uint16_t hz);
u8 PWM_Out_Init_TIM4(uint16_t hz);
void TIM8_Configuration(void);
uint32_t Get_Time_Micros(void);
void TIM10_Configuration(void);
int Get_Tick(void);
double Get_Sys_Ticks(void);

#endif


